September 18 2024
The lab counts for up to 4 points towards the final grade of the course.
Have fun!
Reproduce the steps for data downloading described in lab 2 but applied to another images. You will also need to copy the compressed (.tar or .tar.gz). Here is a summary of the instructions:
Go to Earth explorer (http://earthexplorer.usgs.gov). Click on the login link and enter the credentials that you used in class to open an account.
Click on the “Search Criteria” tab, then type “Fairmount Park” in
the “Feature Name”, select Pennsylvania in the “State” and then click
“Show”. Click on the feature with coordinates 39.8934, -76.6061). This
will show a pin in the selected location in the map view. 39.9834
-75.2099 Zoom in to the pin. Then drag the pin with your mouse towards
an edge of the park. Click on other edges until to produce a polygon
that covers approximately the area of the park (see figure below).
Click on the “Data Sets” tab at the top of the search panel. Then on the drop down menu select Aerial Imagery/NAIP and checkmark the option NAIP.
Click on the results tab and locate the NAIP image with an acaquisition date of 2022-05-10. If you click on the “Show Footprint” button, you will see in the map that this is the scene that covers most of the area of the park.
. Click on the “Download Options”button” at the bottom of the entity (see instructions for lab 2) and download the “Full Resolution” image. The image should download in the default downloads folder in your computer as a compressed file with the name m_3907507_nw_18_060_20220510.ZIP.zip . Your commputer may decompress this image automatically depending on the configuration.
Move the compressed file into the working folder that you will specify as setwd() in R as shown in Part B. Also copy the compressed Landsat image that you used for lab 2 and paste it in the working folder. If you don’t have access to this image anymore, you can follow the steps described in lab 2 to download it.
1.Load required libraries and set working directory
library(terra)
#library(rgdal)
#library(RStoolbox)
wd="/Users/tug61163/Library/CloudStorage/OneDrive-TempleUniversity/Courses/IntroRemoteSensing/2024Fall/Class3_Resolution/Lab3"
setwd(wd)
untar("LC08_L2SP_014032_20240717_20240723_02_T1.tar")
tifs <- list.files('.', pattern='.TIF')
tifs # lists all the files in the working folder with the extension .TIF
tifBandNames=tifs[c(1, 4:9)] # enter the index position for the bands of interest (bands 1 through 7)
L8=rast(tifBandNames)
names(L8)=tifBandNames
names(L8)
unzip("m_3907507_nw_18_060_20220510.ZIP")
naip=rast("m_3907507_nw_18_060_20220510.tif") # The tif file for NAIP has all the bands already stacked
L8 # Provides the metadata associated with the downloaded image.
naip # Provides the metadata associated with the downloaded image.
#plot both images to visualize their extent and resolution
plotRGB(L8, r = 4, g = 3, b = 2, stretch = "lin")
plotRGB(naip, r = 1, g = 2, b = 3, stretch = "lin")
L8rsz=crop(L8, naip)
plotRGB(L8rsz, r = 4, g = 3, b = 2, stretch = "lin")
L8agg=aggregate(L8rsz, fact=8)
plotRGB(L8agg, r = 4, g = 3, b = 2, stretch = "hist") # MODIS resolution (simulated)
plotRGB(L8rsz, r = 4, g = 3, b = 2, stretch = "hist") # Landsat resolution
plotRGB(naip, r = 1, g = 2, b = 3, stretch = "hist") # NAIP resolution
You can also plot the images with a different but equivalent band combination
plotRGB(L8agg, r = 5, g = 4, b = 3, stretch = "hist") # MODIS resolution (simulated)
plotRGB(L8rsz, r = 5, g = 4, b = 3, stretch = "hist") # Landsat resolution
plotRGB(naip, r = 4, g = 3, b = 2, stretch = "hist") # NAIP resolution
pdf("VGutierrez_Lab3.pdf")
plotRGB(L8agg, r = 5, g = 4, b = 3, stretch = "hist") # MODIS resolution (simulated)
plotRGB(L8rsz, r = 5, g = 4, b = 3, stretch = "hist") # Landsat resolution
plotRGB(naip, r = 4, g = 3, b = 2, stretch = "hist") # NAIP resolution
dev.off()
writeRaster(L8agg, filename="MODISres.tif")
writeRaster(L8rsz, filename="LANDSATres.tif")
writeRaster(naip, filename="NAIPres.tif")
Open the three rasters in QGIS by clicking in the option “Layer” in the main menu, and then on “Add Layer” > “Add Raster Layer…”. Browse to the working directory and select the three files saved with the names specified in step 8 and then click on “add”.
Right click on each image and then select “properties. Change the band numbers to display as RGB, using a natural color band combination (the same as the one used in first set of RGB plots displayed in step 6).
Zoom in and out of different locations with all three images and interpret the features that are displayed.
Change again the band numbers to match the combination used for the second set of RGB plots displayed in the second part of step 6.
Zoom in out of different locations with all three images and interpret the features that are displayed. Which band combination is more helpful?
Please provide the information requested in the “Lab3Deliverables.docx” file, available in module 3 in canvas.